package com.xianggu.designMode.orderMethod;


import java.util.Stack;

// 调用者：App控制中心（支持命令队列）
public class AppController {
    private Stack<Command> history = new Stack<>();

    public void executeCommand(Command cmd) {
        cmd.execute();
        history.push(cmd);
    }

    public void undoLastCommand() {
        if (!history.isEmpty()) {
            Command cmd = history.pop();
            cmd.undo();
        }
    }
}